package com.novasoftware.novagooglemap.db;


import com.novasoftware.NovaGoogleMapConfiguration;

import android.app.Activity;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class DatabaseImpl  {

	private static final String DB_NAME = NovaGoogleMapConfiguration.DBName;

	private Activity mActivity;

	public DatabaseImpl(Activity activity){
		this.mActivity = activity;
		create();
	}

	private void create(){
		
		SQLiteDatabase db = mActivity.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null);
		db.execSQL(TableCreate.Natatoria());
		db.execSQL(TableCreate.Student());
		db.execSQL(TableCreate.NovaCategory());
		db.close();
	}
	
	private void Drop()
	{
		mActivity.deleteDatabase(DB_NAME);
		
		SQLiteDatabase db = mActivity.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null);
		db.execSQL("Drop database "+DB_NAME);
		db.close();
	}
	
}
